<html>
<head>
<link href="../tutorial.css" rel="stylesheet" type="text/css">
</head>
<body>

<div class="header">
The NakedMud Tutorial :: Content Scripts
</div>

<!-- content starts here -->
<div class="content-wrap"><div class="content-body-wrap"><div class="content">
<div class="head">mpedit, opedit, and rpedit</div>
<div class="info">
Just about everything in NakedMud is scriptable. In fact, the mere creation of
a room, object, or mobile is just a script being run. Since scripts typically 
deal with rooms, objects, and mobiles, let's start by viewing a mobile's 
generation script. Create a mobile. Give it keywords, a name, a room 
description, and a regular description. Set its race and gender. Then enter the
script editor for it:
<pre class="mud">
> <font class="cmd">mpedit enforcer@moonhaven</font>
</pre>
The 'p' stands for prototype. The scripts that generate game content are
refered to as prototypes. When you use this command, you will see a few 
options to edit. Among them, will be a block of code that looks like this:
<pre class="code">
### The following mproto was generated by medit
### If you edit this script, adhere to the stylistic
### conventions laid out by medit, or delete the top line

### keywords, short descs, room descs, and look descs
me.keywords = "enforcer"  + ", " + me.keywords
me.name     = "an enforcer"
me.rdesc    = "A Moonhaven enforcer is here, keeping the peace."
me.desc     = me.desc + " " + "He is a big brute of a man, with a thickset square 
jaw and big bushy eyebrows. A couple days of stubble covers his face, and he has
a look about him that  suggests he can't wait until you do something bad so he 
has an excuse to pound  your face in with his mace."

### race and gender
me.race     = "human"
me.gender   = "male"
</pre>
Rooms, objects, and mobiles are generated by creating a blank slate copy, and
then running a script over it to assign values. When a builder edits something, 
what they are actually doing is filling in the blanks for a script that will 
later be run.
<p><p/>
One thing to note here is that the mobile is referred to as 'me'. When a script
is run over something, the thing it is being run over is always referred to as
'me', regardless of what it is. Other common script variables will be 
introduced later. 
<p><p/>
A caveat also comes with this command. Every time OLC is opened, it must be
able to properly parse the script that generates a piece of content. This means
reliably knowing that its formatting rules are adhered to. If you do not know
what those rules are, it is highly suggest you only use mpedit, opedit, and
rpedit to view code, and never to edit it. Code can be appended to content
prototypes through the OLC editor (every menu has an 'extra code' section that
you can write in). If you have the need to add extra scripting to content, do
it this way.
</div>



<!-- content ends here-->
</div></div></div>

<!-- navigation starts here -->
<div class="nav-wrap"><div class="nav">
<iframe src="nav.html" height="100%" width="100%" scrolling=no frameborder=0>
</iframe>
<!-- navigation ends here -->
</div></div>

<!--div class="footer">Edit Date: Nov 15, 2008. By Geoff Hollis</div-->
</body>
</html>
